<?php

class UserGroup_model extends CI_Model {
    
    function __construct() {
        parent::__construct();
    }
    
    function get_all(){
        $this->db->order_by('login', 'asc');
        $query = $this->db->get('user');
        
        if($query->num_rows() > 0){
            foreach($query->result() as $row){
                $data[] = $row;
            }
            return $data;
        }
    }
    
    function get($id){
        
        $query = $this->db->get('usergroup');
        if(is_integer($id)):
            
        endif;
        
        if($query->num_rows() > 0){
            foreach($query->result() as $row){
                $data[] = $row;
            }
            return $data;
        }
    }
    
    function count_all(){
        return $this->db->count_all_results('usergroup');
    }
    
}
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
?>
